<template>
    <div class="body">
      
      <div class="register">
             
            <el-input placeholder="请输入验证码" v-model="code">
              
         
            </el-input>
         
            <el-button type="primary" @click="tosubmit">提交</el-button>

            <el-button type="primary" @click="send">发送验证码</el-button>
      </div>
     
  
    </div>
  </template>
  
  <script>
  import reqLogin  from '@/api/login/login'
  // import { startSakura } from '../../utils/js/fullScreenFlower'
  export default {
    mounted(){
        this.username = this.$store.state.userinfo.user.username;
        this.email = this.$store.state.userinfo.user.email
    },

   data(){
        return{
            username:'',
            email:'',
            code:''
        }
       },
       methods:{
       async tosubmit(){
         console.log(this.username);
            const res = await reqLogin.register2(this.username,this.code)
            if(res.code==200){
                this.$message({
                message: '注册成功！',
                type: 'success'
           });
           this.$router.push("/login")
            }else{
                this.$message({
                    message:res.message,
                    type:'warning'
                })
            }
        }
       },
      async send(){
          const res = await reqLogin.sendCode(this.username,this.email)
          console.log(res);
       }
       
    }
    
  
  </script>
  
  <style scoped>
   .body{
    background: url("../../assets/rgback.jpg") no-repeat center center;
    width:100%;
    height: 100%;
    background-size:cover;
    position:absolute;
  
   }
  a{
    color: white;
    text-decoration: none;
    font-size: 16px;
    
  }
   #back{
      width: 40px;
      height: 30px;
      margin-left: 10px;
   }
     .register{
      padding-top: 20px;
      width:450px;
      height: 440px;
      margin: 0 auto;
      margin-top: 100px;
      border: 1px solid rgba(11, 11, 11, 0.2);
      border-radius: 20px;
      box-shadow:  10px 10px  10px  rgba(44, 43, 43,0.4);
      background-color: rgba(255, 255, 255, 0.58);
      text-align: center;
     }
      /* #login-button{
          margin-right: 50px;
  
      } */
      .el-form-item{
          margin-top: 30px;
          line-height: 40px;
          width: 400px;
      }
      .regbutton{
        width: 300px;
        height: 45px;
        border-radius: 8px;
        font-size: 18px;
  
      }
  </style>